package cn.edu.lcu.cs.designpattern.state.trafficlight.state;

public class RedState extends TrafficState {
    public RedState(TrafficLight light) {
        super("红色", 30, light);
    }

    @Override
    public void change() {
        display(); // 显示当前状态
        countdown--; // 心跳计数
        if (countdown==0) {
            // 改变状态，红灯的后续状态为绿灯
            light.setState(new GreenState(light));
        }
     }
}
